﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
using Abp.Domain.Entities;
using Abp.Organizations;
using KelonProud.Extensions;

namespace KelonProud.Administration.Domain.Organizations
{
    public class KelonProudOrganizationUnit: OrganizationUnit
    {
        public virtual string NamePath { get; set; }

        public virtual string IdPath { get; set; }

        public virtual string Icon { get; set; }

        public virtual byte Level { get; set; }

        [DefaultValue(OrganizationType.General)]
        public virtual OrganizationType OrganizationType { get; set; }

        public  virtual ICollection<KelonProudOrganizationUnit> Children1 { get; set; }

        [ForeignKey("ParentId")]
        public  virtual KelonProudOrganizationUnit Parent1 { get; set; }


        [NotMapped]
        public string FullName => NamePath.HasValue() ? NamePath.Replace("-", "_"):"";
    }

    public enum OrganizationType:byte {
        [EnumDisplay("机构")]
        General,
        [EnumDisplay("部门")]
        Department
    }
}
